cmake_minimum_required(VERSION 2.8)

project(SRS)

set(CMAKE_CXX_FLAGS "-std=c++11 ${CMAKE_CXX_FLAGS}")
set(CMAKE_CXX_FLAGS_DEBUG  "${CMAKE_CXX_FLAGS_DEBUG} -ggdb -O0 -Wall -pg -std=c++11")
set(CMAKE_CXX_FLAGS_RELEASE "-ggdb -O2 -Wall -std=c++11")

set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin)
set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/lib)

set(LFT_YUN_LIBS $ENV{LFT_YUN_LIBS})
set(BASE_SERVER_LIBS $ENV{BASE_SERVER_LIBS})

# boost
set(Boost_USE_STATIC_LIBS ON)
find_package(Boost COMPONENTS system filesystem thread REQUIRED)

add_definitions(-DNO_USING_LOG=1)

include_directories(
	${PROJECT_SOURCE_DIR}/src
	${PROJECT_SOURCE_DIR}/src/app
	${PROJECT_SOURCE_DIR}/src/core
	${PROJECT_SOURCE_DIR}/src/kernel
	${PROJECT_SOURCE_DIR}/src/libs/hp
	${PROJECT_SOURCE_DIR}/src/main
	${PROJECT_SOURCE_DIR}/src/protocol
	${PROJECT_SOURCE_DIR}/src/rtmp
	${PROJECT_SOURCE_DIR}/src/utest
	${PROJECT_SOURCE_DIR}/libs/inc_linux
	${LFT_YUN_LIBS}/l-include
	${LFT_YUN_LIBS}/include
	${BASE_SERVER_LIBS}/Src
	${BASE_SERVER_LIBS}/Src/Core
)

link_directories(
	${LIBRARY_OUTPUT_PATH}
	${PROJECT_SOURCE_DIR}/libs/lib_linux
	${LFT_YUN_LIBS}/libs/linux
	${LFT_YUN_LIBS}/libs/linux/grpc
	${BASE_SERVER_LIBS}/lib
)

# 共用库
set(SRS_LIBS
	-llsrs
	-lHConfig
	-lHUtils
	-lHetcd
	-letcd-cpp-api
	-lcpprest
	-lgrpc++
	-lgrpc
	-lares
	-lgpr
	${Boost_LIBRARIES}
	-lprotobuf
	-lglog
	-lgflags
	-lcurl
	-lz
)

add_subdirectory(cmake/librtmp)
add_subdirectory(cmake/libsrs)
add_subdirectory(cmake/srs)
add_subdirectory(cmake/srs_hls)
add_subdirectory(cmake/srs_test)
add_subdirectory(cmake/research)
